<template>
  <div>
    <van-field readonly label="附件名称" type="text" :value="form.AttName"></van-field>
    <van-field readonly label="大小" type="text" :value="form.AttFileFileSizeZ"></van-field>
    <van-field readonly label="创建日期" type="text" :value="form.CreateDate|formatDate"></van-field>
    <div class="coursedetail" style="margin-top: 5px" v-if="Attachs.length > 0">
      <div style="padding: 10px; color: ##00c1de">附件</div>
      <file-format :fileLists="Attachs"></file-format>
    </div>
  </div>
</template>
<script>
import srcValue from "@/utils/srcValue.js";
import { nsOccupationalDiseasesFileDetail } from "@/api/ns";
import FileFormat from '../../../components/Attach/FileFormat.vue';

export default {
  components: { FileFormat},
  data() {
    return {
      id: this.$route.query.id,
      autoSize: { minRows: 1 },
      form: {},
      Attachs: []
    };
  },
  created() {
    this.getDetail();
  },
  methods: {
    getDetail() {
      var me = this;
      let params = { id: this.id };
      nsOccupationalDiseasesFileDetail(params).then(res => {
        me.form = res.data;
        if (res.data.Attachs != null) {
          me.Attachs = JSON.parse(res.data.Attachs.replace(/'/g, '"'));
        }
        me.form.TypeList = me.form.Type == null ? [] : me.form.Type.split(",");
      });
    },
    srcValue2(AttExt) {
      return srcValue(AttExt);
    },
    goFile(attachCode) {
      this.$router.push("/Attach/AatachDetail?attCode=" + attachCode);
    }
  }
};
</script>
<style scoped="less">
.van-field__control {
  background: #fff;
}
</style>